<div class="tableform" style=" padding:3px; margin:0;">
<div onclick="addGrp()" class="sysiconBtn addorder"><{t}>添加一个参数组<{/t}></div>
<div id="params_box" style="height:400px;overflow:auto">
<{assign var=grpItem value=0}>
<{foreach from=$gtype.params key=key item=groupitems}>
<div class="tableform" style=" border:1px solid #C7DBE5; margin:0 0 5px 0" grp="<{$grpItem}>">
  参数组名称:<input name="gtype[params][<{$grpItem}>][group]" value="<{$key|escape:html}>"/><span onclick="addGrpItem(this)" class="sysiconBtn addorde"><{t}>为这个参数组添加一个参数<{/t}></span><span class="sysiconBtn delete" onclick="delGrpItem(this)"><{t}>删除此参数组<{/t}></span>
  <div class="division"><ul class="grp-item">
<{assign var=grpPrmItem value=0}>
<{foreach from=$groupitems key=keyx item=option}>
    <li style="clear:both"><{t}>参数名：<{/t}><input name="gtype[params][<{$grpItem}>][name][<{$grpPrmItem}>]" value="<{$keyx|escape:html}>"  size="15" /><span<{if !$gtype.type_id}> style="display:none"<{/if}>><{t}>别名：<{/t}><input name="gtype[params][<{$grpItem}>][alias][<{$grpPrmItem}>]" value="<{$option}>"/><span class="notice-inline"><{t}>用“|”分隔：<{/t}></span></span><span onclick="delGrpItem(this)"><{img title="删除" alt="删除"  src="bundle/delecate.gif" app='desktop'}></span></li>
<{assign var=grpPrmItem value=$grpPrmItem+1}>
<{/foreach}>
  </ul></div> 
</div>
<{assign var=grpItem value=$grpItem+1}>
<{/foreach}>
</div>
</div>

<script>
var grpItem = 0;
var GRPTMP = '<div class="tableform" style=" border:1px solid #C7DBE5; margin:0 0 5px 0" grp="{key}">参数组名称:<input name="gtype[params][{key}][group]" value=""/><span onclick="addGrpItem(this)" class="sysiconBtn addorde"><{t}>为这个参数组添加一个参数<{/t}></span><span class="sysiconBtn delete" onclick="delGrpItem(this)"><{t}>删除此参数组<{/t}></span><div class="division"><ul class="grp-item"></ul></div></div>';

var GRPITEMTMP = '<li style="clear:both"><{t}>参数名：<{/t}><input name="gtype[params][{key}][name][{keyx}]" value=""  size="15" /><span><{t}>别名：<{/t}><input name="gtype[params][{key}][alias][{keyx}]" value=""/><span class="notice-inline"><{t}>用“|”分隔：<{/t}></span></span><span onclick="delGrpItem(this)"><{img title="删除" alt="删除"  src="bundle/delecate.gif" app="desktop"}></span></li>';

var addGrp = (function(){
    var grp = new Element('div').set('html',GRPTMP.substitute({'key':'new_'+(grpItem++)})).getFirst();
    $('params_box').adopt(grp);
    addGrpItem(grp.getElement('.addorde'));
});
var addGrpItem = (function(el){
    var tableform = el.getParent('.tableform');
    tableform.getElement('.grp-item').adopt(new Element('div').set('html',GRPITEMTMP.substitute({'key':tableform.get('grp'),'keyx':'new_'+(grpItem++)})).getFirst());
});
var delGrpItem = (function(el){
  el.parentNode.parentNode.removeChild(el.parentNode);
});
</script>